package com.goroom.v_thread_init;

public class ThreadTemplate {
    /**
     * 利用Thread来创建一个线程
     */
    public void fromThread(){
        new Thread(){
            @Override
            public void run() {
                System.out.println("[from Thread]" + Thread.currentThread().getName());
            }
        }.start();
    }

    /**
     * 利用Runnable来初始化一个线程
     */
    public void fromRunable(){
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("[from Runnable] " + Thread.currentThread().getName());
            }
        }).start();
    }
}
